package com.zxy.service;

import com.zxy.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class BookService {

//可与 @Primary组合使用   @Qualifier("bookDao")指定装配   @Primary默认装配
    @Qualifier("bookDao")
    @Autowired(required = false)
//    @Resource
    private BookDao bookDao;

    public void print(){
        System.out.println(bookDao);
    }

    @Override
    public String toString() {
        return "BookService{" +
                "bookDao=" + bookDao +
                '}';
    }
}
